# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Fabio Ribeiro <fabiorphp@gmail.com>
pkgname=php7-pecl-mongodb
_pkgreal=mongodb
pkgver=1.8.0
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgdesc="PHP7 MongoDB driver"
url="https://pecl.php.net/package/mongodb"
arch="all"
license="Apache-2.0"
depends="php7-json"
makedepends="cyrus-sasl-dev icu-dev openssl-dev pcre-dev php7-dev re2c snappy-dev"
source="https://pecl.php.net/get/$_pkgreal-$_pkgver.tgz"
builddir="$srcdir"/$_pkgreal-$_pkgver
provides="php7-mongodb=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-mongodb" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr \
		--with-php-config=/usr/bin/php-config7
	make
}

check() {
	# tests requires additional dependencies (vagrant)
	php7 -d extension="$builddir"/modules/$_pkgreal.so --ri $_pkgreal
}

package() {
	make INSTALL_ROOT="$pkgdir/" install

	local confdir="$pkgdir/etc/php7/conf.d"
	install -d $confdir
	echo "extension=$_pkgreal.so" > $confdir/$_pkgreal.ini
}

sha512sums="7fd54dabde8df9533abd36d159c3da1c2b4606e7788b8a6d41faf83d0710b74885e8bfb4e1f4837a50248f3af1df2e7414b90f99227fc92c9084f779c7e68698  mongodb-1.8.0.tgz"
